Skip to content

Conversation

@AmirSa12
Copy link
Contributor

@AmirSa12 AmirSa12 commented Oct 28, 2025

This PR introduces tab completion functionality for the wrangler cli, improving developer experience by allowing shell(zsh, powershell, fish, bash) autocompletion for commands, options, values, and flags. This also comes with npm, pnpm, yarn and bun copmpletions! ( npm exec ... , pnpm ... ) With this PR, users can navigate available commands, options and values more efficiently and faster with speeding up workflow.

A small video of how this looks:

wrangler.mp4

Fixes #53


Open with Devin

@AmirSa12 AmirSa12 requested a review from a team as a code owner October 28, 2025 08:33
@changeset-bot
Copy link

changeset-bot bot commented Oct 28, 2025

🦋 Changeset detected

Latest commit: b2fc39e

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@AmirSa12 AmirSa12 force-pushed the feat/tab-completions branch from 45886d3 to e9c0d42 Compare October 30, 2025 12:01
Copy link
Member

@dario-piotrowicz dario-piotrowicz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome stuff, thanks so much @AmirSa12 🙏

I've left a comment regarding the completions setup, could you take a look? 😄

Also could you advise on how I can manually test this feature? 🙂
(is there a setup required, etc...)

@@ -0,0 +1,304 @@
// NOTE: The provided option-value completions can be customized or removed as needed.
// NOTE: Descriptions and flags based on https://developers.cloudflare.com/workers/wrangler/commands/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that taking the values from the docs and using them here is a bit problematic (as we'd also need to keep them in sync, etc...)

Could you try to instead use the experimental_getWranglerCommands function to dynamically get the information you need and setup the completions from that? 🙂

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @dario-piotrowicz ! Thanks for your review!
Yes, I will try to use the experimental_getWranglerCommands and let you know how it works with that!
I'll keep you posted!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! thanks! 🫶

@AmirSa12
Copy link
Contributor Author

AmirSa12 commented Nov 4, 2025

Awesome stuff, thanks so much @AmirSa12 🙏

I've left a comment regarding the completions setup, could you take a look? 😄

Also could you advise on how I can manually test this feature? 🙂 (is there a setup required, etc...)

Thank you, @dario-piotrowicz!
Yeah sure!
if you want to test the package manager completions, you can simply do that by first, isntalling tab: npm install -g @bomb.sh/tab and then source the script: source <(tab pnpm zsh) ( if you are using pnpm and zsh... npm, bun, and yarn are also supported ) then you can simply have tab completions and do pnpm <TAB>
the above works for your current shell session only, if you want to have that permanently, you would want to add it to ~/.zshrc

on top of this, if you have your own cli, you can have completions for that as well, and if your cli is executed through a package manager, and supports tab completions, lets assume wrangler does, the next example would also work: pnpm wrangler <TAB>

@dario-piotrowicz
Copy link
Member

Awesome stuff, thanks so much @AmirSa12 🙏
I've left a comment regarding the completions setup, could you take a look? 😄
Also could you advise on how I can manually test this feature? 🙂 (is there a setup required, etc...)

Thank you, @dario-piotrowicz! Yeah sure! if you want to test the package manager completions, you can simply do that by first, isntalling tab: npm install -g @bomb.sh/tab and then source the script: source <(tab pnpm zsh) ( if you are using pnpm and zsh... npm, bun, and yarn are also supported ) then you can simply have tab completions and do pnpm <TAB> the above works for your current shell session only, if you want to have that permanently, you would want to add it to ~/.zshrc

on top of this, if you have your own cli, you can have completions for that as well, and if your cli is executed through a package manager, and supports tab completions, lets assume wrangler does, the next example would also work: pnpm wrangler <TAB>

Thanks @AmirSa12 😄

So... if I understand correctly for pnpm wrangler <TAB> to work I (and every wrangler user) need to globally install the @bomb.sh/tab package and enable it in my terminal?

@AmirSa12
Copy link
Contributor Author

AmirSa12 commented Nov 4, 2025

Awesome stuff, thanks so much @AmirSa12 🙏
I've left a comment regarding the completions setup, could you take a look? 😄
Also could you advise on how I can manually test this feature? 🙂 (is there a setup required, etc...)

Thank you, @dario-piotrowicz! Yeah sure! if you want to test the package manager completions, you can simply do that by first, isntalling tab: npm install -g @bomb.sh/tab and then source the script: source <(tab pnpm zsh) ( if you are using pnpm and zsh... npm, bun, and yarn are also supported ) then you can simply have tab completions and do pnpm <TAB> the above works for your current shell session only, if you want to have that permanently, you would want to add it to ~/.zshrc
on top of this, if you have your own cli, you can have completions for that as well, and if your cli is executed through a package manager, and supports tab completions, lets assume wrangler does, the next example would also work: pnpm wrangler <TAB>

Thanks @AmirSa12 😄

So... if I understand correctly for pnpm wrangler <TAB> to work I (and every wrangler user) need to globally install the @bomb.sh/tab package and enable it in my terminal?

@dario-piotrowicz, the whole tab package relies on shell scripts.. all the magic happens in the shell, so in-order to have the completions, we need a shell script ( think of it as a plugin ) to inject in our terminal. by installing tab, you are only injecting the shell script, in other ways this means you can directly do source <(npx '@bomb.sh/tab' pnpm zsh) without installing the package globally, but installing the package is recommended because tab completions would be faster that way! let me know if that makes sense to you or if you have feedback or any other questions!
Almost in most of the completion systems, this script injection is required.

@dario-piotrowicz
Copy link
Member

dario-piotrowicz, the whole tab package relies on shell scripts.. all the magic happens in the shell, so in-order to have the completions, we need a shell script ( think of it as a plugin ) to inject in our terminal. by installing tab, you are only injecting the shell script, in other ways this means you can directly do source <(npx '@bomb.sh/tab' pnpm zsh) without installing the package globally, but installing the package is recommended because tab completions would be faster that way! let me know if that makes sense to you or if you have feedback or any other questions! Almost in most of the completion systems, this script injection is required.

I see, great! thanks for the clarification 😄🙏

@AmirSa12
Copy link
Contributor Author

AmirSa12 commented Nov 9, 2025

@dario-piotrowicz , I'm amazed by what I could achieve via the experimental_getWranglerCommands ! thank you for suggesting that! this is better now.
FYI NuxtCLI also follows a similar approach here: https://github.com/nuxt/cli/pull/1082/files#diff-985455627f7b91035ad2df15aeb5461a9da8da1305d47ef492654bf0b449c019R3

but one note, I noticed that, by using this function, we are only handling options that have explicit choices defined in the command args (like log-level) some option values (like --port values) are not included. let me know if you want to add common defaults for these common options (like port numbers: 8787, 8080, 3000, or protocols: http, https and ..)

@NuroDev
Copy link
Contributor

NuroDev commented Dec 23, 2025

Thank you for your contribution @AmirSa12, however we have decided to move forward with #11637 instead as it offers both a bit more in-house control of this feature and a test suite to match.

@NuroDev NuroDev closed this Dec 23, 2025
@github-project-automation github-project-automation bot moved this from Untriaged to Done in workers-sdk Dec 23, 2025
@AmirSa12
Copy link
Contributor Author

AmirSa12 commented Dec 23, 2025

Hey!
Thanks for checking the PR ❤️

I'd like to add some context and technical details regarding the approaches used in both this PR and #11637
one of the main strengths of bomb.sh/tab is that it provides package manager shell completions, which is something the other PR( #11637 ) approach does not currently address... This approach includes npm, pnpm, yarn and bun support which is a huge win for user experience! (pnpm wrangler <TAB>) and also package.json and fs completions!

On top of this, tab also supports Windows PowerShell... this is a notable advantage as PowerShell support is often missing or incomplete is many completions solutions!

from a quality and reliability standpoint, tests can be added for this PR as well.

tab library provides a simple api for defining completions in your cli tool... which includes commands, options, positional arguments, and custom handlers for dynamic suggestions!
tab also supports framework adapters (CAC, Citty, Commander.js), which makes it easier to integrate with many cli ecosystems.

If this approach is still not desired, I recommend an alternative to be the cli tool wrangler is using (yargs) as it provides completions. however it’s important to note that yargs completion also lacks package manager integration and powershell support.

Additionally, we're happy to add tests or address any missing features or gaps you think tab has as part of this work, so those improvements can be included here and benefit other users as well.

cc @dario-piotrowicz @NuroDev @ascorbic @dmmulroy

wrangler.mp4

@NuroDev NuroDev reopened this Jan 5, 2026
@github-project-automation github-project-automation bot moved this from Done to Untriaged in workers-sdk Jan 5, 2026
@AmirSa12 AmirSa12 requested review from a team as code owners January 5, 2026 17:23
@NuroDev
Copy link
Contributor

NuroDev commented Jan 15, 2026

Hey @AmirSa12, is there anything else needed on this or do you need any help with anything? Happy to lend a hand to help get this over the line and merged 😄

@Aslemammad
Copy link

hey @NuroDev, sorry for the inactivity, we've had some personal issues on the side, i'll look into this and see if i can move it forward!

@Aslemammad
Copy link

ok i had a look, i think as you suggested, maybe we can merge this PR and open another PR later that can add more choices to those options not having them or adding custom handlers that handle those options.

It might take more work so splitting it up in another PR might be a quicker and cleaner way to do this. This way when @AmirSa12 is back, he can have a serious look at it too.

Let me know what you think @NuroDev, and again, really sorry for the delay!

Copy link
Contributor

@NuroDev NuroDev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just added a few tiny nit pick suggestions about removing some self explanitory comments, and 2 small comments.

Apart from that this LGTM and ready to go 🚀

Copy link
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 potential issue.

View issue and 3 additional flags in Devin Review.

Open in Devin Review

@NuroDev NuroDev added the skip-pr-description-validation Skip validation of the required PR description format label Jan 21, 2026
Copy link
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 new potential issue.

View issue and 7 additional flags in Devin Review.

Open in Devin Review

@github-project-automation github-project-automation bot moved this from Untriaged to Approved in workers-sdk Jan 21, 2026
@NuroDev NuroDev merged commit bba0968 into cloudflare:main Jan 21, 2026
38 of 39 checks passed
@github-project-automation github-project-automation bot moved this from Approved to Done in workers-sdk Jan 21, 2026
@Aslemammad
Copy link

thank you so much team for this, we really appreciate it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-pr-description-validation Skip validation of the required PR description format

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

bash/zsh completions

6 participants